﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DoAnASP;
using System.Data;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
            Load_Thuonghieu();
            KiemSoat();
            lbl_SoLuongKhach0.Text = "Số lượng: " +  Application["SoLuongTruyCap"].ToString();
    }

    public void  KiemSoat()
    {
        if ((bool)Session["DangDangNhap"] == true)
        {
            pnDangNhap.Visible = false;
            pnDangXuat.Visible = true;
            //Response.Redirect("TrangChu.aspx");
        }
        else
        {
            pnDangNhap.Visible = true;
            pnDangXuat.Visible = false;
           // Response.Redirect("TrangChu.aspx");
        }

    }
    private void Load_Thuonghieu()
    {
        BUS_ThuongHieu busTH = new BUS_ThuongHieu();
        DataTable dt = new DataTable();
        dt = busTH.Load_Thuonghieu();
        DataList2.DataSource = dt.DefaultView;
        DataList2.DataBind();
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("TrangChu.aspx");
    }

    //protected void btnTimKiemTheoten_Click(object sender, ImageClickEventArgs e)
    //{
    //    BUS_SanPham tiemkiem = new BUS_SanPham();
    //    DataTable dt = new DataTable();
    //    dt = tiemkiem.TiemKiemTheoTen(txb_SeachName.Text);
        
    //}
    protected void txb_SeachName_TextChanged(object sender, EventArgs e)
    {
        if (txb_SeachName.Text == "")
        {
           // btnTimKiemTheoten.Enabled = false;
        }
        else
        {
           // btnTimKiemTheoten.Enabled = true;
        }
    }
    protected void ID_TamTrieu_Click(object sender, EventArgs e)
    {
        Session["IDGia"] = "1";
        Session["KTTiemKiem"] = 0;
        Response.Redirect("TimKiem.aspx");
    }
    protected void ID_12_Trieu_Click(object sender, EventArgs e)
    {
        Session["IDGia"] = "2";
        Session["KTTiemKiem"] = 0;
        Response.Redirect("TimKiem.aspx");
    }
    protected void ID_15_Trieu_Click(object sender, EventArgs e)
    {
        Session["IDGia"] = "3";
        Session["KTTiemKiem"] = 0;
        Response.Redirect("TimKiem.aspx");
    }
    protected void ID_Tren_20_Trieu_Click(object sender, EventArgs e)
    {
        Session["IDGia"] = "4";
        Session["KTTiemKiem"] = 0;
        Response.Redirect("TimKiem.aspx");
    }


    protected void btnSeachName_Click(object sender, ImageClickEventArgs e)
    {
        //Session["KTTiemKiem"] = 1;
        Response.Redirect("TimKiem.aspx?kytu=" + txb_SeachName.Text);
    }
}
